﻿using System;
using System.Collections.Generic;
using System.Text;
using XDesigner.ORM ;

namespace XDesigner.ORM.Test
{
    [ORMType("Suppliers")]
    [System.ComponentModel.TypeConverter(typeof(MyTypeConverter))]
    public class SupplierClass
    {
        public SupplierClass()
        {
        }

        private int _SupplierID = 0;
        [ORMKeyField()]
        public int SupplierID
        {
            get { return _SupplierID; }
            set { _SupplierID = value; }
        }

        private string _CompanyName = null;

        public string CompanyName
        {
            get { return _CompanyName; }
            set { _CompanyName = value; }
        }

        private string _ContactName = null;

        public string ContactName
        {
            get { return _ContactName; }
            set { _ContactName = value; }
        }

        private string _ContactTitle = null;

        public string ContactTitle
        {
            get { return _ContactTitle; }
            set { _ContactTitle = value; }
        }

        private string _Address = null;

        public string Address
        {
            get { return _Address; }
            set { _Address = value; }
        }

        private string _City = null;

        public string City
        {
            get { return _City; }
            set { _City = value; }
        }

        private string _Region = null;

        public string Region
        {
            get { return _Region; }
            set { _Region = value; }
        }

        private string _PostalCode = null;

        public string PostalCode
        {
            get { return _PostalCode; }
            set { _PostalCode = value; }
        }

        private string _Country = null;

        public string Country
        {
            get { return _Country; }
            set { _Country = value; }
        }

        private string _Phone = null;

        public string Phone
        {
            get { return _Phone; }
            set { _Phone = value; }
        }

        private string _Fax = null;

        public string Fax
        {
            get { return _Fax; }
            set { _Fax = value; }
        }

        private string _HomePage = null;

        public string HomePage
        {
            get { return _HomePage; }
            set { _HomePage = value; }
        }

        private List<ProductClass> _Products = null;
        [ORMRelation(ORMRelationStyle.OneToMany, "SupplierID", UniteDeleteForDelete = true)]
        [ORMDelay()]
        public virtual List<ProductClass> Products
        {
            get { return _Products; }
            set { _Products = value; }
        }

        public override string ToString()
        {
            return "Supplier:" + this.CompanyName;
        }
    }
}
